fix(news): custom RSS feed save fails with validation error when no logo#329
Conversation
_set_missing_booleans_to_false was unconditionally creating an empty
dict for every nested-object sub-property when processing array items.
For the news plugin's custom_feeds, this produced logo:{} on every feed
item that had no logo uploaded. jsonschema then validated that empty
object against logo's required:["id","path"] constraint and failed.
Fix: skip recursion into a sub-object when it isn't already present in
the array item. There's no reason to create an optional object like
logo just to look for boolean fields inside it.
Also extend _filter_config_by_schema to recurse into array items when
the items schema has properties. Previously arrays were passed through
unchanged, so any stray field on a feed item (legacy data, migration
artifacts) would survive to validation where additionalProperties:false
would reject it.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR refines two internal configuration helpers in ChangesConfiguration Form and Schema Handling
🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
Root Cause
_set_missing_booleans_to_falsewas unconditionally creating an empty dict for every nested-object sub-property when processing array items. For the news plugin'scustom_feeds, this producedlogo: {}on every feed item where no logo was uploaded.jsonschema then validated that empty object against the
logoschema'srequired: ["id", "path"]constraint and rejected it — even thoughlogoitself is optional on the item.Execution order that exposed the bug:
fix_array_structures— converts{"0": {...}}→[{...}]_set_missing_booleans_to_false— injectedlogo: {}on items with no logo_filter_config_by_schema— passed arrays through unchanged (didn't strip the empty object)validate_config_against_schema— failed onlogo: {}missingidandpathChanges
_set_missing_booleans_to_false(api_v3.py~line 4279): Skip recursion into a nested object sub-property when it isn't already present in the array item. The function's purpose is to set unchecked boolean checkboxes toFalse— there's no reason to create an optional object likelogojust to search for booleans inside it._filter_config_by_schema(api_v3.py~line 4426): Extended to recurse into array items when theitemsschema hasproperties. Previously arrays passed through unchanged, so any extra field on a feed item (legacy data, migration artifacts) would survive to validation whereadditionalProperties: falsewould reject it. This is a defensive improvement that catches any future similar case.Test Plan
config/config.jsonhas no spuriouslogo: {}entries on feeds without logos🤖 Generated with Claude Code
Summary by CodeRabbit